package com.taxi.entity.json;

import cn.hutool.core.convert.Convert;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.taxi.util.DateTimeHelper;

import java.io.IOException;
import java.util.Date;

/**
 * @Author Dell
 * @Date 2021/6/11 17:03
 */
public class DateCustomerDeserializer extends JsonDeserializer<Date> {

    @Override
    public Date deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        return DateTimeHelper.intToDate(Convert.toInt(p.getText()));
    }
}
